package com.business.business.web.web;

import cn.hutool.json.JSONObject;
import com.business.business.common.base.BaseController;
import com.business.business.support.annotaion.Action;
import com.business.business.support.model.RespEntity;
import com.business.business.web.service.EmgPlaceService;
import com.business.business.web.service.EmgProfessorService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * @Author xulumin
 * @Date 2024/3/20 14:02
 * @Version 1.0
 * @Desc 应急专家控制器
 */
@Controller
@Action
@RequestMapping(value = "emergencyProfessor")
public class EmgProfessorController extends BaseController {
    @Resource
    private EmgProfessorService emgProfessorService;

    /**
     * Author: xulumin
     * Date: 2024/3/19
     * Description: 应急专家新增或者更新
     */
    @PostMapping("addOrUpdateProfessor")
    public RespEntity addOrUpdateProfessor(@RequestBody(required = false) JSONObject jsonObject) throws IllegalAccessException, InstantiationException {
        return emgProfessorService.addOrUpdateProfessor(jsonObject);
    }

    /**
     * Author: xulumin
     * Date: 2024/3/19
     * Description: 应急专家信息列表
     */
    @GetMapping("getProfessorList")
    public RespEntity getProfessorList(@RequestBody(required = false) JSONObject jsonObject) {
        return emgProfessorService.getProfessorList(jsonObject);
    }

    /**
     * Author: xulumin
     * Date: 2024/3/20
     * Description: 获取应急专家
     */
    @GetMapping("getProfessorInfo")
    public RespEntity getProfessorInfo(@RequestBody(required = false) JSONObject jsonObject) {
        return emgProfessorService.getProfessorInfo(jsonObject);
    }

    /**
     * Author: xulumin
     * Date: 2024/3/19
     * Description: 删除应急专家
     */
    @PostMapping("delProfessor")
    public RespEntity delProfessor(@RequestBody(required = false) JSONObject jsonObject) {
        return emgProfessorService.delProfessor(jsonObject);
    }
}
